<?php
namespace app\frontend\controller;
use think\Db;
use think\Controller;
class Te extends Controller
{
    public function index()
    {
    	$shopcartId1=db('order')->where("order_number='2019041452485551'")->field('shopcart_id')->find();
		
           dump($shopcartId1);
          
           $ret=$shopcartId1['shopcart_id'];
           dump($ret);
           
          
           $supplier='(4,5)';
           /*$shopcartId2=explode(',', $shopcartId1);
		   dump($shopcartId2);
		   foreach ($shopcartId2 as $key ) {
		   	if($key!='')
		   	{
		   		$shopcart_id1[]=$key;
		   	}
		   }
		   dump($shopcart_id1);*/
		   $where['shopcart_id']=array('in','4,5');
		   dump($where);

			$shopcart_id=db('shopcart')->where('shopcart_id','in',$ret)->field('product_amount,product_number')->select();
			dump($shopcart_id);
			dump(count($shopcart_id));
			for($j=0;$j<count($shopcart_id);$j++)
		      {
		      	$shopcartNewid=$shopcart_id[$j];
		      	dump($shopcartNewid);
		      	$change=db('product')->where("product_number='{$shopcartNewid['product_number']}'")->setInc('product_sales',$shopcartNewid['product_amount']);
		      	$change=db('product')->where("product_number='{$shopcartNewid['product_number']}'")->setDec('product_count',$shopcartNewid['product_amount']);
	        		
		      }



    }
 }